package cn.yonyong.base.project.others.quartz;

import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Describtion Todo
 * @Author yonyong
 * @Date 2019/9/6 16:19
 * @Version 1.0.0
 **/
@Component
@EnableScheduling
public class UseQuartz{

    //在线cron表达式生成  http://cron.qqe2.com
    @Scheduled(cron = "0/50 * * * * ? ")
    public void printCurrentTime() {
        System.out.println();
        System.out.println("任务调度-----Current Time is:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }
}
